﻿using System.Windows;
using Amarok.Agents;


namespace Amarok.Samples
{
	/// <summary>
	/// </summary>
	public partial class App : Application
	{
		private MyRuntime mRuntime;


		/// <summary>
		/// </summary>
		protected override void OnStartup(StartupEventArgs e)
		{
			base.OnStartup(e);

			mRuntime = new MyRuntime();
			mRuntime.Start();

			var windowDesc = new ShellWindowDescription();
			windowDesc.Create(mRuntime.Environment, AgentOptions.Empty);
			App.Current.MainWindow = windowDesc.Window;
			App.Current.MainWindow.Show();
		}

		/// <summary>
		/// </summary>
		protected override void OnExit(ExitEventArgs e)
		{
			base.OnExit(e);

			mRuntime.Shutdown(true);
			mRuntime.Wait();
		}

	}
}
